﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BilbilDAL;
using Common;
using Modles.DTO;
using Modles.Models;

namespace BilbilBLL
{
    public class ManageCarouselService
    {
        private CarouselDAL CarouselDAL = new CarouselDAL();
        private CarouselTwoDAL carouselTwoDAL = new CarouselTwoDAL();
        private ImageDAL imageDAL = new ImageDAL();
        public ResponseTool GetImages()
        {
            return ResponseTool.Succeed(imageDAL.GetImages());
        }
        public ResponseTool AddCarousel(int ImageId)
        {
            if(ImageId == 0) { return ResponseTool.Fail("ImageId不能为空"); }
            if (CarouselDAL.AddCarousel(ImageId))
            {
                return ResponseTool.Succeed("添加成功");
            }
            else
            {
                return ResponseTool.Fail("添加失败");
            }
        }
        
        public ResponseTool DeleteCarousel(int Id)
        {
            if (Id == 0) { return ResponseTool.Fail("Id不能为空"); }
            if (CarouselDAL.DeleteCarousel(Id))
            { 
                return ResponseTool.Succeed("删除成功");
            }
            else
            {
                return ResponseTool.Fail("删除失败");
            }
        }


        public ResponseTool AddCarouselTwo(int ImageId)
        {
            if (ImageId == 0) { return ResponseTool.Fail("ImageId不能为空"); }
            if (carouselTwoDAL.AddCarouselTwo(ImageId))
            {
                return ResponseTool.Succeed("添加成功");
            }
            else
            {
                return ResponseTool.Fail("添加失败");
            }
        }

        public ResponseTool DeleteCarouselTwo(int Id)
        {
            if (Id == 0) { return ResponseTool.Fail("Id不能为空"); }
            if (carouselTwoDAL.DeleteCarouselTwo(Id))
            {
                return ResponseTool.Succeed("删除成功");
            }
            else
            {
                return ResponseTool.Fail("删除失败");
            }
        }

    }
}
